import React, {Component} from "react";
import SplashView from "../common/widget/SplashView";
import {Platform, StyleSheet, Text, View, StatusBar} from "react-native";
import {NavigationActions} from "react-navigation";
// import SplashScreen from 'react-native-splash-screen'
export default class SplashScene extends Component<> {

    static navigationOptions = ({navigation}: any) => ({
            header: null,
        }
    )

    render() {
        return (
            <View style={styles.container}>
                <StatusBar
                    backgroundColor='#ff0000'
                    translucent={true}
                    hidden={true}
                    animated={true}
                />
                <SplashView source={require('../../res/img/splash.jpg')} animateEnd={()=>{

                    //重置根视图，闪屏页=>主界面后销毁掉
                    const resetAction = NavigationActions.reset({
                        index: 0,
                        actions: [NavigationActions.navigate({ routeName: 'home'})]})
                        this.props.navigation.dispatch(resetAction)
                }}/>
            </View>
        );
    }

    // componentDidMount() {
    //     SplashScreen.hide();//关闭启动屏幕
    // }
}


const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
});
